home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / am120.zip / AUTOMATE.SCR < prev    next >
Text File  |  1991-02-15  |  19KB  |  872 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;; AutoMate Automated File Transfer Script for Qmodem 4.XX  ;;;
  3. ;;; By Marc S. Hedish, ABSOLUT(e)LY TEMPORARY (702) 254-8601 ;;;
  4. ;;; (C) Copyright 1991 Marc S. Hedish - All Rights Reserved  ;;;
  5. ;;; Version 1.2 - 02/15/91 - Production Release              ;;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7. If "$0" = "AMDIAL" Start
  8. Graphics ANSI
  9. TurnOn 8_BIT
  10. TurnOff ECHO PRINT SPLIT BS_DEL LINEFEED
  11. String QWKFILE REPFILE NAME PROT DOORNUM CMDFILE CMD FILENAME UP DN FIRST
  12. String DESCRIPTION PWORD TEMP OLDATTR STATUS TRIES CONF CHECK LANG PROMPT TYPE
  13. GoTo Start
  14. GetMail:
  15. If "$TYPE" = "QMH" NA
  16. TimeOut 45 Abort
  17. Send "^M"
  18. WaitFor "$PROMPT"
  19. Delay 1000
  20. If "$TYPE" = "SF" SFG
  21. Send "OPEN $DOORNUM^M"
  22. XGetMail:
  23. TimeOut 300 Abort
  24. When "doors are" NoDoors
  25. When "<NO TRANSFER>" NoMsg
  26. When "No Messages Found..." NoMsg
  27. When "<DLASK>" "Y^M"
  28. When "<AUTOSTART>" "^[^["
  29. When "this packet" "Y^M"
  30. When "]oodbye" "Y^M"
  31. When "Type for transfer" "$PROT^M"
  32. When "Begin Your Download" Mega
  33. When "Choice - [" SFM
  34. Assign TRIES 1
  35. Loop6:
  36. WaitFor "Command"
  37. Pause 1000
  38. Send "D$PROT^M"
  39. WaitFor "$QWKFILE"
  40. Mega:
  41. Pause 1000
  42. AtWrite 61 05 031 "Attempt - $TRIES"
  43. Assign CHECK $PROT
  44. Gosub CheckProtocol
  45. Download $PROT $DN$QWKFILE
  46. If $SUCCESS Loop7
  47. WaitFor "Command"
  48. Incr TRIES
  49. If "$TRIES" > "3" FailedGetMail
  50. GoTo Loop6
  51. Loop7:
  52. When "abort automatic" SFMailDone
  53. When "MegaMail" MegaDone
  54. Send "^M"
  55. WaitFor "Command"
  56. Loop7a:
  57. Pause 1000
  58. Readfile CMD
  59. If "$CMD" = "LogOff" Log2
  60. Send "Q^M"
  61. Assign TEMP Skip
  62. MegaDone:
  63. WaitFor "$PROMPT"
  64. Return
  65. SFG:
  66. If "$CMD" = "ExchangeMail" SFG1:
  67. Send "M^M"
  68. WaitFor "$PROMPT"
  69. Delay 1000
  70. SFG1:
  71. Send "$DOORNUM^M"
  72. Assign TEMP SFM
  73. GoTo XGetMail
  74. SFMail:
  75. When "protocol:" "$PROT^M"
  76. When "return you" "Y"
  77. Delay 1000
  78. Send "1^M"
  79. WaitFor "to process:"
  80. Pause 2000
  81. Send "Q^M"
  82. WaitFor "to extract:"
  83. Pause 1000
  84. Send "N"
  85. When "you? [y/n]" "Y^M"
  86. WaitFor "Ready to send"
  87. GoTo Mega
  88. SFMailDone:
  89. When
  90. Send "A"
  91. SFMD:
  92. WaitFor "$PROMPT"
  93. GoTo Loop7a
  94. FailedGetMail:
  95. Decr TRIES
  96. AtWrite 12 06 252 "    Failed download of $QWKFILE after $TRIES attempts.    "
  97. Stamp Failed download of mail packet $QWKFILE after $TRIES attempts.
  98. Gosub Error
  99. GoTo Loop7
  100. NoDoors:
  101. AtWrite 12 06 252 "       Mail door not available at the present time.       "
  102. Stamp Mail door not available at the present time.
  103. Gosub Error
  104. Return
  105. NoMsg:
  106. Stamp No messages found to retrieve.  Unable to download $QWKFILE.
  107. GoTo Loop7
  108. CheckProtocol:
  109. If "$CHECK" = "G" Abort
  110. If "$CHECK" = "F" Abort
  111. If "$CHECK" = "Y" Abort
  112. If "$CHECK" = "O" Abort
  113. If "$CHECK" = "R" Abort
  114. If "$CHECK" = "C" Abort
  115. If "$CHECK" = "X" Abort
  116. If "$CHECK" = "A" Abort
  117. GetScr
  118. Return
  119. SendReplies:
  120. If "$TYPE" = "QMH" NA
  121. Exist $UP$REPFILE DoIt
  122. AtWrite 18 06 252 " No replies to send.  $REPFILE not found. "
  123. Stamp No replies to send.  $REPFILE not found.
  124. Gosub Error
  125. Return
  126. DoIt:
  127. TimeOut 45 Abort
  128. Send "^M"
  129. WaitFor "$PROMPT"
  130. Delay 1000
  131. If "$TYPE" = "SF" SFR
  132. Send "OPEN $DOORNUM^M"
  133. SFC:
  134. When "no DOORS are" NoDoors
  135. When "transfer now..." DjSend
  136. When "Reader Now..."  DjSend
  137. When "Sorry" CantSend
  138. When "Type for transfer" "$PROT^M"
  139. When "Choice - [" SFM
  140. Assign TRIES 1
  141. Loop8:
  142. WaitFor "Command"
  143. Pause 1000
  144. Send "U$PROT^M"
  145. WaitFor "$REPFILE"
  146. DjSend:
  147. Pause 1000
  148. AtWrite 61 05 031 "Attempt - $TRIES"
  149. Assign CHECK $PROT
  150. Gosub CheckProtocol
  151. Upload $PROT $UP$REPFILE
  152. If $SUCCESS Loop9
  153. Send "^M"
  154. Incr TRIES
  155. If "$TRIES" > "3" FailedSendReplies
  156. GoTo Loop8
  157. Loop9:
  158. If "$CMD" = "ExchangeMail" Abort
  159. If "$TEMP" = "SFM" SFMD
  160. Send "^M"
  161. WaitFor "Command"
  162. GoTo Loop7a
  163. SFR:
  164. Send "M^M"
  165. WaitFor "$PROMPT"
  166. Delay 1000
  167. Send "$DOORNUM^M"
  168. GoTo SFC
  169. SFM:
  170. If "$TEMP" = "SFM" SFMail
  171. When "protocol:" "$PROT^M"
  172. Assign TEMP SFM
  173. Delay 1000
  174. Send "2^M"
  175. WaitFor "abort!"
  176. GoTo DjSend
  177. FailedSendReplies:
  178. Decr TRIES
  179. AtWrite 12 06 252 "     Failed upload of $REPFILE after $TRIES attempts.     "
  180. Stamp Failed upload of mail packet $REPFILE after $TRIES attempts.
  181. Gosub Error
  182. Send "^M"
  183. GoTo Loop9
  184. CantSend:
  185. Stamp Unable to send replies.  Not enough available time.
  186. GoTo Loop9
  187. DeleteReplies:
  188. Exist $UP$REPFILE DelReplyPacket
  189. Return
  190. DelReplyPacket:
  191. DOS "ERASE $UP$REPFILE"
  192. Exist $UP$REPFILE RepliesNotDeleted
  193. Return
  194. RepliesNotDeleted:
  195. AtWrite 12 06 252 "            ERROR! - Could not delete replies.            "
  196. Stamp Could not delete replies - $UP$REPFILE.
  197. Gosub Error
  198. Return
  199. DeleteMail:
  200. Exist $DN$QWKFILE DelMailPacket
  201. Return
  202. DelMailPacket:
  203. DOS "ERASE $DN$QWKFILE"
  204. Exist $DN$QWKFILE MailNotDeleted
  205. Return
  206. MailNotDeleted:
  207. AtWrite 12 06 252 "          ERROR! - Could not delete mail packet.          "
  208. Stamp Could not delete mail packet - $DN$QWKFILE.
  209. Gosub Error
  210. Return
  211. ExchangeMail:
  212. Gosub SendReplies
  213. If "$TEMP" = "SFM" GetMail
  214. Exist $UP$REPFILE XGetMail
  215. GoTo GetMail
  216. GetFiles:
  217. TimeOut 45 Loop3
  218. When "] Command" ProGet
  219. When "not found" FileNotFound
  220. When "does not exist" FileNotFound
  221. When "no match." FileNotFound
  222. When "Start your download" GetEm2
  223. When "download of" GetEm2
  224. When "password for downloading?" PwdGet
  225. When "Incorrect" BadPwd
  226. Loop2:
  227. ReadFile FILENAME
  228. If "$FILENAME" = "_EOF_" AbortFile
  229. If "$FILENAME" = " " AbortFile
  230. If "$FILENAME" = "*" AbortFile
  231. AtWrite 61 05 031 "            "
  232. AtWrite 61 05 031 "$FILENAME"
  233. Assign TRIES 0
  234. Loop3:
  235. If $OFFLINE Abort
  236. Incr TRIES
  237. Send "^M"
  238. WaitFor "$PROMPT"
  239. Delay 1000
  240. If "$TYPE" = "SF" SFGet
  241. If "$TYPE" = "GAP" SFGet
  242. If "$TYPE" = "QMH" QMGet
  243. Send "D $FILENAME $PROTOCOL^M"
  244. GetEm:
  245. WaitFor "(Ctrl-X)"
  246. GetEm2:
  247. Delay 1000
  248. Assign CHECK $PROTOCOL
  249. Gosub CheckProtocol
  250. Download $PROTOCOL $DN$FILENAME
  251. If $SUCCESS Loop2
  252. Incr TRIES
  253. If "$TRIES" > "3" FailedDownload
  254. GoTo Loop3
  255. SFGet:
  256. If "$TEMP" = "Y" SFGet1
  257. Send "F"
  258. SFGet1:
  259. Send "^M"
  260. WaitFor "$PROMPT"
  261. Assign TEMP Y
  262. Delay 1000
  263. If "$TYPE" = "GAP" GAPGet
  264. When "Protocol" "$PROTOCOL^M"
  265. When "transfer now" "Y^M"
  266. When "Ready to Send" GetEm2
  267. When "not allowed here" Loop3
  268. Send "D^M"
  269. WaitFor "download:"
  270. Delay 1000
  271. Send "$FILENAME^M^M"
  272. WaitFor "$PROMPT"
  273. GoTo Loop3
  274. QMGet:
  275. Send "D^M"
  276. WaitFor "aborts > "
  277. Delay 1000
  278. Send "$PROTOCOL^M"
  279. WaitFor "ends > "
  280. Delay 1000
  281. Send "$FILENAME^M^M"
  282. WaitFor "Cancel"
  283. GoTo GetEm2
  284. GAPGet:
  285. When "(e/c)" "C^M"
  286. When "Log Off" "N^M"
  287. Send "D $FILENAME $PROTOCOL^M^M"
  288. WaitFor "Ready To Send"
  289. GoTo GetEm2
  290. ProGet:
  291. Delay 1000
  292. Send "D $PROTOCOL $FILENAME S^M"
  293. GoTo GetEm
  294. PwdGet:
  295. ReadFile DESCRIPTION
  296. If "$DESCRIPTION" = "_EOF_" Abort
  297. If "$DESCRIPTION" = " " Abort
  298. If "$DESCRIPTION" = "*" Abort
  299. Send "$DESCRIPTION^M"
  300. GoTo GetEm
  301. FailedDownload:
  302. Decr TRIES
  303. Stamp Failed download of $FILENAME after $TRIES attempts.
  304. GoTo Loop2
  305. FileNotFound:
  306. Stamp Failed download.  $FILENAME not on $BOARD.
  307. GoTo Loop2
  308. BadPwd:
  309. Stamp Failed download of $FILENAME due to incorrect password.
  310. GoTo Loop2
  311. AbortFile:
  312. If "$TEMP" <> "Y" Abort
  313. Send "^M"
  314. WaitFor "$PROMPT"
  315. Delay 1000
  316. Send "Q^M"
  317. Return
  318. SendFiles:
  319. TimeOut 45 Loop5
  320. When "] Command" ProSend
  321. When "duplicates a current board file." OnFile
  322. When "already exists" OnFile
  323. When "Sorry" NoUploads
  324. When "currently disabled" NoUploads
  325. Loop4:
  326. ReadFile FILENAME
  327. If "$FILENAME" = "_EOF_" AbortFile
  328. If "$FILENAME" = " " AbortFile
  329. If "$FILENAME" = "*" AbortFile
  330. If "$TYPE" = "QMH" SkipDesc
  331. If "$TYPE" <> "GAP" ReadDesc
  332. ReadFile CONF
  333. If "$CONF" = "_EOF_" AbortFile
  334. If "$CONF" = " " AbortFile
  335. If "$CONF" = "*" AbortFile
  336. ReadFile PWORD
  337. If "$PWORD" = "_EOF_" AbortFile
  338. If "$PWORD" = " " AbortFile
  339. If "$PWORD" = "*" AbortFile
  340. ReadDesc:
  341. ReadFile DESCRIPTION
  342. If "$DESCRIPTION" = "_EOF_" AbortFile
  343. If "$DESCRIPTION" = " " AbortFile
  344. If "$DESCRIPTION" = "*" AbortFile
  345. AtWrite 61 05 031 "            "
  346. AtWrite 61 05 031 "$FILENAME"
  347. SkipDesc:
  348. Assign TRIES 0
  349. Exist $UP$FILENAME Loop5
  350. AtWrite 12 06 252 " $FILENAME not found in upload directory. "
  351. Stamp Failed upload.  $FILENAME not found in upload directory.
  352. Gosub Error
  353. GoTo Loop4
  354. Loop5:
  355. If $OFFLINE Abort
  356. Incr TRIES
  357. Send "^M"
  358. WaitFor "$PROMPT"
  359. Delay 1000
  360. If "$TYPE" = "SF" SFSend
  361. If "$TYPE" = "GAP" SFSend
  362. If "$TYPE" = "QMH" QMSend
  363. Send